﻿
#pragma once


#include <hadoop/Mapper.h>
#include <hadoop/Reducer.h>
#include <hadoop/MapContext.h>
#include <hadoop/ReduceContext.h>
#include <hadoop/RecordReader.h>
#include <hadoop/RecordWriter.h>
#include <hadoop/Partitioner.h>
namespace HadoopPipes {
	/**
	* A factory to create the necessary application objects.
	*/
	class Factory {
	public:
		virtual Mapper* createMapper(MapContext& context) const = 0;
		virtual Reducer* createReducer(ReduceContext& context) const = 0;

		/**
		* Create a combiner, if this application has one.
		* @return the new combiner or NULL, if one is not needed
		*/
		virtual Reducer* createCombiner(MapContext& context) const {
			return NULL; 
		}

		/**
		* Create an application partitioner object.
		* @return the new partitioner or NULL, if the default partitioner should be 
		*     used.
		*/
		virtual Partitioner* createPartitioner(MapContext& context) const {
			return NULL;
		}

		/**
		* Create an application record reader.
		* @return the new RecordReader or NULL, if the Java RecordReader should be
		*    used.
		*/
		virtual RecordReader* createRecordReader(MapContext& context) const {
			return NULL; 
		}

		/**
		* Create an application record writer.
		* @return the new RecordWriter or NULL, if the Java RecordWriter should be
		*    used.
		*/
		virtual RecordWriter* createRecordWriter(ReduceContext& context) const {
			return NULL;
		}

		virtual ~Factory() {}
	};

}